package middleware

import (
	"context"

	"github.com/gin-gonic/gin"
)

func InjectMiddleware(ctx context.Context, g *gin.Engine) error {
	dbsetMiddleware, err := WithDataset(ctx)
	if err != nil {
		return err
	}
	g.Use(dbsetMiddleware)

	cacheMiddleware, err := WithCache(ctx)
	if err != nil {
		return err
	}

	g.Use(cacheMiddleware)
	return nil
}
